package com.lcifn.springmvc.config;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration.Dynamic;

import org.springframework.stereotype.Component;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.XmlWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

public class AppWebApplicationInitializer{ //implements WebApplicationInitializer{

	public void onStartup(ServletContext servletContext) throws ServletException {
		XmlWebApplicationContext ac = new XmlWebApplicationContext();
		ac.setConfigLocation("");
		
		Dynamic registration = servletContext.addServlet("dispatcher-d", new DispatcherServlet(ac));
		registration.setLoadOnStartup(1);
		registration.addMapping("/");
	}

}
